
package com.myway.core.common;

import java.util.HashMap;


/**
 *@description
 *
 * TODO your comment for 
 *
 */
public enum XCDTicketStatus
{
	
	/**
	 * 未分配

	 */
	UNDP("UNDP"),		
	/**
	 * 未使用

	 */
	AVLB("AVLB"),	
	
	/**
	 * 已打印

	 */
	PRTD("PRTD"),
	
	/**
	 * 已作废

	 */
	VOID("VOID"),
	
	/**
	 * 已回收

	 */
	RFND("RFND"),
	
	//以下为confirmStaus状态

	/**
	 * 作废已确认

	 */
	CONFIRM("CONFIRM"),
	/**
	 * 作废未确认

	 */
	UNCONFIRM("UNCONFIRM"),
	/**
	 * 拒绝审批确认
	 */
	REFUSECONFIRM("REFUSECONFIRM"),
	
	//以下为returnStatus状态

	/**
	 * 已回传

	 */
	RETURN("RETURN"),
	/**
	 * 未回传

	 */
	UNRETURN("UNRETURN"),
	/**
	 * 回传失败
	 */
	RETURNLOSE("RETURNLOSE");
	
	/**
	 * Alias name. This is the name which will be stored in database.
	 */
	private final String alias;

	/**
	 * A hash map which keep all the ticket status enum with alias name as key.
	 */
	private static HashMap<String, XCDTicketStatus> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, XCDTicketStatus>();
		for (XCDTicketStatus status : XCDTicketStatus.values()) {
			map.put(status.alias, status);
		}
	}

	XCDTicketStatus(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	public String getAlias() {
		return alias;
	}

	/**
	 * Return a <code>TicketStatus</code> object holding the value of specified alias name
	 * 
	 * @param alias
	 *            the alias name of the status
	 * 
	 * @return a <code>TicketStatus</code> object holding the value represented by the alias name
	 *         argument
	 */
	public static XCDTicketStatus valueOfAlias(String alias) {
		XCDTicketStatus status = map.get(alias);

		if (status == null) {
			throw new IllegalArgumentException("Unknown ticket status alias [" + alias + "]");
		}

		return status;
	}
}
